package com.pay.sdk.example;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.pay.sdk.service.channel3.ChannelThreePay;

/**
 * 通道3-一网通代码示例
 * @author Administrator
 *
 */
public class Channel3Example {

	public static void main(String[] args) {
        System.out.println("==重要== 调用任何API前，请先配置Configure类");
//        prePayExample();
//        prePayQueryExample();
    }
	
	  
    /**
     * 已网通
     * @throws  
     */
    public static void prePayExample(){
    	try {
    		String out_trade_no = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
        	String total_fee = "1"; //单位分
        	String body = "一网通测试";
        	String card_type = "2";
        	String user_id = "2017030601";
        	String mobile = "18200982382";//
        	String notify_url = "http://paytest.shopping98.com/pay/apiNotify.shtml";
        	String time_expire = "30";
        	//非必填字段
        	String return_url = "http://www.baidu.com";
        	String attach = "";
        	String lon = "";
        	String lat = "";
        	String result = ChannelThreePay.prePay(out_trade_no,total_fee,body,card_type,user_id,mobile,notify_url,time_expire,return_url,attach,lon,lat);
        	
        	System.out.println(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
    }
    
    
    /**
     * 一网通订单查询
     */
    public static void prePayQueryExample(){
    	try {
    		String out_trade_no = "";
    		String transaction_id = "599678222580645888";
    		String out_transaction_id = "";
        	String result = ChannelThreePay.prePayQuery(out_trade_no, transaction_id, out_transaction_id);
        	System.out.println("一网通支付结果查询："+result);
		} catch (Exception e) {
			e.printStackTrace();
		}
    }
	
	
}
